<?php
use Yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use yii\helpers\Url;
$this->title = '财务管理';
?>

<div class="container">
    <div class="row">
      
        <?php echo $this->render('_leftnav') ?>
        <div class="col-md-10">
          <div class="page-header clearfix">
            <h1 class="pull-left">现金账单</h1>
            <div class="pull-right">

                                            
            </div>
          </div>
    <?php
	$form = ActiveForm::begin([
	'action' => ['coin/index'],
	'method'=>'post',
	'options' => [
					'enctype' => 'multipart/form-data',
					'class'=>'form-inline well well-sm',
	                'id' => 'user-search-form'
				 ]	
		]);	
	?>              
      <div class="form-group">       
        <?=Html::dropDownList('usertime', $where['usertime']?$where['usertime']:0, ArrayHelper::map(['全部记录','最近一周','最近两周','最近一个月','最近两个月','最近三个月'],'id', 'customer_name'), ['class' => 'form-control']);?>
      </div>
    <div class="form-group">
        <?= Html::input('text', 'username',$where['username']?$where['username']:'', ['class' => 'form-control','placeholder'=>'用户名']) ?>
    </div>
    <?= Html::submitButton('搜索', ['class'=>'btn btn-primary']) ?>
    <a class="btn btn-primary" href="<?=Url::toRoute(['coin/index', 'del' =>1]);?>">清空条件</a>
    <a class="btn btn-primary" href='<?=Url::toRoute(['coin/exportbill']);?>'>导出结果</a>
    <?php ActiveForm::end(); ?>    
    <script>
		function Export(data){
			alert(data[0]['bill_id']);
		}
    </script>
    <table class="table table-hover table-striped" id="article-table">
	<thead>
		<tr>			
			<th width="10%">流水号</th>
			<th width="20%">用户名</th>
			<th width="15%">收入/支出</th>
			<th width="18%">现金</th>
			<th width="15%">成交时间</th>
<!-- 			<th width="15%">操作</th> -->
		</tr>
	</thead>
	<tbody>	
<?php foreach($lists as $key=>$val):?>
<tr id="article-<?=Html::encode($val['bill_id'])?>" align='left'>
	
	<td>
		<span class="text-muted">
			<b><?=Html::encode($val['billserial'])?></b>
		</span>
	</td>
	<td>
		<span class="text-muted">
			<b><?=Html::encode($val['username'])?></b>
		</span>
	</td>
	<td>
	   <?php if($val['billstatus']==1){ ?>
	   <font color='green'>+收入</font>
	   <?php }else if($val['billstatus']==2){ ?>
	   <font color='red'>-支出</font>
	   <?php } ?>
	</td>
	<td>
		<b><?=$val['billmoney']?></b>/元
	</td>

	<td>
		<span class="text-success"><?=date('Y-m-d H:i:s',$val['addtime']);?></span>
	</td>

<!-- 	<td> -->
<!-- 		<div class="btn-group">
		  <a href="" class="btn btn-default btn-sm">编辑</a> -->
<!-- 		  <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> -->
<!-- 		    <span class="caret"></span> -->
<!-- 		  </a> -->
<!-- 		  <ul class="dropdown-menu"> -->
<!-- 		  		     				    <li><a href="javascript:" data-role="unpublish-item" data-url="/admin/article/12/unpublish">取消发布</a></li> -->
<!-- 		    		    			    <li><a href="javascript:" data-role="trash-item" data-url="/admin/article/12/trash">移至回收站</a></li> -->
<!-- 		    		    		  </ul> -->
<!-- 			</div> -->
<!-- 		</td> -->
	</tr>
<?php endforeach; ?>	
	</tbody>
   </table>
    
    <div style=' margin-left:38%;'>
	 <?= LinkPager::widget(['pagination' => $pages]); ?>
	 </div>

   <!--  <div class="table-responsive">
      <div class="empty">暂无记录</div><table class="table table-striped">
                
              </table>
    </div> -->
   


        </div>

          </div>
  </div>
